<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    /*
    在ES5中继承是借助原型对象实现的 
    */
    function Person(name, age) {
      this.name = name
      this.age = age
    }

    /*女人构造函数*/
    function Woman() {

    }
    Woman.prototype = new Person("pink老师",35)
    Woman.prototype.constructor = Woman
    const pink = new Woman()
    console.log(pink);
    console.log(pink.name,pink.age);

    /*男人构造函数*/
    function Man() {

    }
    Man.prototype = new Person("马云",56)
    Man.prototype.constructor = Man
    const peiqi = new Man()
    console.log(peiqi);
    console.log(peiqi.name,peiqi.age);
  </script>
</body>

</html>